// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
// 登录
import login from '@/views/login';
// 首页
import index from '@/views/index';
//变量控制
import RealData from '@/views/variant/RealData'
//报警管理
import AlarmMgr from '@/views/alarm/alarmMgr'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}


// 启用路由
Vue.use(Router);

// 导出路由 
export default new Router({
    routes: [{
        path: '/',
        name: '',
        component: login,
        hidden: true,
        meta: {
            requireAuth: false
        }
    }, {
        path: '/login',
        name: '登录',
        component: login,
        hidden: true,
        meta: {
            requireAuth: false
        }
    }, {
        path: '/index',
        name: '首页',
        component: index,
        iconCls: 'el-icon-tickets',
        children: [{
            path: '/varinat/realData',
            name: '数据监控',
            component: RealData,
            meta: {
                requireAuth: true
            }
        },{
            path: '/alarm/alarmMgr',
            name: '报警管理',
            component: AlarmMgr,
            meta: {
                requireAuth: true
            }  
        }]
    }]
})